package model_new

import (
	"exercise/application/yiran/app/initialize"
	"gorm.io/gorm"
)

type BaseModel struct {
	CreateTime int `gorm:"create_time;type:timestamp;" json:"create_time"` // 添加时间
}

func NewBaseModel() *BaseModel {
	return &BaseModel{}
}

func (b *BaseModel) DB(model ...interface{}) (db *gorm.DB) {
	if model != nil {
		return initialize.YrDbConnect().Model(model[0])
	}
	return initialize.YrDbConnect()
}
